package com.code.shiro.user.service;

import com.code.wanmi.entity.wm_user.UserDto;

import com.code.wanmi.entity.wm_user.WmSysMenu;
import com.code.wanmi.entity.wm_user.WmSysRole;
import com.code.wanmi.entity.wm_user.WmSysUser;
import com.code.wanmi.entity.wm_user.dto.SysUserDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


import java.util.List;
import java.util.Set;

@FeignClient("user")
public interface UserService {
//用户controller
    /**
     * 显示所有用户
     * @return
     */
    @RequestMapping(value = "/user/select",method = RequestMethod.GET)
    String selectUsers();

    /**
     *删除某个用户
     */
    @RequestMapping(value = "/user/remove",method = RequestMethod.PATCH)
    String removeUser(@RequestBody WmSysUser user);
    /**
     * 添加用户操作及分配角色
     * &对已有用户添加角色
     * @return
     */
    @RequestMapping(value = "/user/insertSysUser",method = RequestMethod.POST)
    String insertUser(@RequestBody SysUserDto dto);
    /**
     * 用户登录
     * @param user
     * @return
     */
    @RequestMapping(value = "/user/login",method = RequestMethod.POST)
    String login(@RequestBody WmSysUser user);

    /**修改用户信息*/
    @RequestMapping(value = "/user/insertSysUser",method = RequestMethod.PUT)
    String updateUser(@RequestBody WmSysUser wmSysUser);

    /**通过用户id查询用户角色信息*/
    @RequestMapping(value = "/user/getrole",method = RequestMethod.GET)
    Set<WmSysRole> getRoleNameByUserId(@RequestParam("uid") Long uid);

    /**通过用户登录名和密码查询用户信息*/
    @RequestMapping(value = "/user/selectUserByIdAndLoginName",method = RequestMethod.GET)
    WmSysUser selectUserByIdAndLoginName(@RequestBody WmSysUser wmSysUser1);







    //角色controller
    /**
     * 显示WmSysRole角色信息
     * @return
     */
    @RequestMapping(value = "/role/dispaly", method = RequestMethod.GET)
    String dispalyWmSysRole();

    /**添加角色与菜单权限(测试)*/
    @PutMapping("/menu/addRoleMenu")
    String addRoleMenu(@RequestBody UserDto userDto);
//    /**
//     * 添加角色
//     * @param wmSysRole
//     * @return
//     */
//    @RequestMapping(value = "/role/add",method = RequestMethod.POST)
//    String addRole(@RequestBody WmSysRole wmSysRole);
    /**
     * 根据角色ID删除角色
     * @return
     */
    @RequestMapping(value = "/role/deleteRole",method = RequestMethod.PATCH)
    String deleteRoleById(@RequestParam("roleId") Long roleId);





    //菜单权限controller
    /**
     * 根据菜单ID列表删除权限
     * @param menu_id
     * @return
     */
    @RequestMapping(value = "/role/delete", method = RequestMethod.GET)
    String deleteRole(@RequestBody List<Long> menu_id);
    /**
     * 通过角色ID，查询角色权限。
     */
    @RequestMapping(value = "/role/find",method = RequestMethod.GET)
    String getRoleid(@RequestParam("role_id") long role_id);



    /**
     * 修改菜单权限信息
     * @param wmSysMenu
     * @return
     */
    @RequestMapping(value = "/menu/updateMenu",method = RequestMethod.PUT)
    String updateMenu(@RequestBody WmSysMenu wmSysMenu);

    /**
     * 通过用户ID查询用户权限信息
     * @param uid
     * @return
     */
    @RequestMapping(value = "/user/userInfo",method = RequestMethod.GET)
    String userInfo(@RequestParam("uid") Long uid);



//    @RequestMapping(value = "/user/updateUserRole",method = RequestMethod.PUT)
//    String updateUserRole(@RequestBody SysUserDto dto);



//    /*修改角色菜单权限*/
//    @PostMapping("/user/updateRoleMenu")
//    String updateRoleMenu(@RequestBody UserDto userDto);





}
